package sketch.shape.geom.prim;

import sketch.shape.ShapeThreshold;

public class gLength {

	public double length;

	public gLength(double d) {
		length = d;
	}

	public static double getIdenticalThreshold() {
		return ShapeThreshold.lengthIdentical;
	}

	public static double getEqualThreshould() {
		return ShapeThreshold.lengthDis;
	}

	public boolean identical(gLength mate) {
		return disAbs(mate) < getIdenticalThreshold();
	}

	public double getDouble() {
		return length;
	}

	public int getInt() {
		return (int) length;
	}

	public boolean equals(gLength mate) {
		return disAbs(mate) < getEqualThreshould();
	}

	public boolean equals2(gLength mate) {
		return disAbs(mate) < 2 * getEqualThreshould();
	}

	public boolean equals3(gLength mate) {
		return disAbs(mate) < 3 * getEqualThreshould();
	}

	public double disAbs(gLength mate) {
		return Math.abs(getDouble() - mate.getDouble());
	}

	public double dis(gLength mate) {
		return getDouble() - mate.getDouble();
	}
}
